home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
7_10.lha
/
7_10
/
p_pause.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
1KB
|
37 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
include <process.h>
include <debug.h> /* DELETE */
/ Stop this process until rescheduled by something.
/ Make certain that the process_object alertobj wakes us up.
oid process::pause(process_object *alertobj)
if (debug) /*DELETE*/ cerr << "process" << this << "::pause(" << alertobj << ")\n";
if (mustrecurse())
pause();
else
{
if (alertobj)
alertobj->remember(this);
if ((this == t_thisprocess) ||
rmfromlist(this, &t_runprocesses) ||
rmfromlist(this, &t_waitprocesses))
{
t_next = t_waitprocesses;
t_waitprocesses = this;
t_curstate = TASK_IDLE;
}
if (debug) /*DELETE*/ cerr << "\t" << this << "->t_curstate <- " << ps_print(t_curstate) << "\n";
// save and schedule another process
if (this == t_thisprocess)
if (!contextswitch())
schedule();
if (debug) /*DELETE*/ cerr << "<<<< process" << this << "::pause(" << alertobj << ")\n";
}